/**
 * selectize.bootstrap3.css (v@@version) - Bootstrap 3 Theme
 * Copyright (c) 2013–2015 Brian Reavis & contributors
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
 * file except in compliance with the License. You may obtain a copy of the License at:
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under
 * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
 * ANY KIND, either express or implied. See the License for the specific language
 * governing permissions and limitations under the License.
 *
 * @author Brian Reavis <brian@thirdroute.com>
 */

@import "../bootstrap/variables.less";
@import "../bootstrap/mixins.less";
@import "selectize";

@selectize-font-family: inherit;
@selectize-font-size: inherit;
@selectize-line-height: @line-height-computed;

@selectize-color-text: @text-color;
@selectize-color-highlight: rgba(255,237,40,0.4);
@selectize-color-input: @input-bg;
@selectize-color-input-full: @input-bg;
@selectize-color-input-error: @state-danger-text;
@selectize-color-input-error-focus: darken(@selectize-color-input-error, 10%);
@selectize-color-disabled: @input-bg;
@selectize-color-dropdown-item-create-text: @text-color;
@selectize-color-item: var(--selectize-tag-bg);
@selectize-color-item-border: rgba(0,0,0,0);
@selectize-color-item-active: @component-active-bg;
@selectize-color-item-active-text: #fff;
@selectize-color-item-active-border: rgba(0,0,0,0);
@selectize-color-optgroup: @dropdown-bg;
@selectize-color-optgroup-text: @dropdown-header-color;
@selectize-color-optgroup-border: @dropdown-divider-bg;
@selectize-color-dropdown: @dropdown-bg;
@selectize-color-dropdown-border-top: @input-border;
@selectize-color-dropdown-item-active: @dropdown-link-hover-bg;
@selectize-color-dropdown-item-active-text: @dropdown-link-hover-color;
@selectize-color-dropdown-item-create-active-text: @dropdown-link-hover-color;
@selectize-opacity-disabled: 0.5;
@selectize-shadow-input: none;
@selectize-shadow-input-focus: inset 0 1px 2px rgba(0,0,0,0.15);
@selectize-shadow-input-error: inset 0 1px 1px rgba(0, 0, 0, .075);
@selectize-shadow-input-error-focus: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 6px lighten(@selectize-color-input-error, 20%);
@selectize-border: 1px solid @input-border;
@selectize-border-radius: @input-border-radius;

@selectize-width-item-border: 0;
@selectize-padding-x: @padding-base-horizontal;
@selectize-padding-y: @padding-base-vertical;
@selectize-padding-dropdown-item-x: @padding-base-horizontal;
@selectize-padding-dropdown-item-y: 3px;
@selectize-padding-item-x: 6px;
@selectize-padding-item-y: 2px;
@selectize-margin-item-x: 3px;
@selectize-margin-item-y: 3px;
@selectize-caret-margin: 0;

@selectize-arrow-size: 5px;
@selectize-arrow-color: @selectize-color-text;
@selectize-arrow-offset: @selectize-padding-x + 5px;

.selectize-dropdown, .selectize-dropdown.form-control {
	height: auto;
	padding: 0;
	margin: 2px 0 0 0;
	z-index: @zindex-dropdown;
	background: @selectize-color-dropdown;
	border: 1px solid @dropdown-fallback-border;
	border: 1px solid @dropdown-border;
	.selectize-border-radius(@border-radius-base);
	.selectize-box-shadow(0 6px 12px rgba(0,0,0,.175));
}

.selectize-dropdown {
	.optgroup-header {
		font-size: @font-size-small;
		line-height: @line-height-base;
	}
	.optgroup:first-child:before {
		display: none;
	}
	.optgroup:before {
		content: ' ';
		display: block;
		.nav-divider(var(--border-color));
		margin-left: @selectize-padding-dropdown-item-x * -1;
		margin-right: @selectize-padding-dropdown-item-x * -1;
	}
}

.selectize-dropdown-content {
	padding: 5px 0;
}

.selectize-dropdown-header {
	padding: @selectize-padding-dropdown-item-y * 2 @selectize-padding-dropdown-item-x;
}

.selectize-input {
	min-height: @input-height-base;

	&.dropdown-active {
		.selectize-border-radius(@selectize-border-radius);
	}
	&.dropdown-active::before {
		display: none;
	}
	&.focus {
		@color: @input-border-focus;
		@color-rgba: rgba(red(@color), green(@color), blue(@color), .2);
		border-color: @color;
		outline: 0;
		.selectize-box-shadow(~"inset 0 1px 1px rgba(0,0,0,.075), 0 0 0 4px @{color-rgba}");
	}
}

.has-error .selectize-input {
    border-color: @selectize-color-input-error;
    .selectize-box-shadow(@selectize-shadow-input-error);

    &:focus {
        border-color: @selectize-color-input-error-focus;
        .selectize-box-shadow(@selectize-shadow-input-error-focus);
    }
}

.selectize-control {
	&.multi {
		.selectize-input.has-items {
			padding-left: @selectize-padding-x - @selectize-padding-item-x;
			padding-right: @selectize-padding-x - @selectize-padding-item-x;
		}
		.selectize-input > div {
			.selectize-border-radius(@selectize-border-radius - 1px);
		}
	}
}

.form-control.selectize-control {
	padding: 0;
	height: auto;
	border: none;
	background: none;
	.selectize-box-shadow(none);
	.selectize-border-radius(0);
}
